using System;
using System.Collections.Generic;
using System.Text;
using System.Reflection;
using System.Drawing;
using Controller;
namespace _dmis.CustomUI
{
    class PopupPicker
    {
        private static PopupPicker m_popPicker;

        private PopupPicker()
        {
            //Assembly ass = Assembly.
            Assembly[] asses = AppDomain.CurrentDomain.GetAssemblies();
            if(asses!=null)
            {
                foreach (Assembly ass in asses)
                {
                    foreach (Type t in ass.GetTypes())
                    {
                        //if (!(t is ICommand))
                        //    continue;
                        MethodInfo mi = t.GetMethod("MenuItemName");
                        if (mi == null)
                            continue;
                        string itemName = mi.Invoke(null, null) as string;

                        m_popups.Add(itemName, t);
                    }
                }                
            }
        }
        public static PopupPicker GetPopupDlgPicker()
        {
            if (m_popPicker == null)
                m_popPicker = new PopupPicker();
            return m_popPicker;
        }
        Dictionary<string, Type> m_popups = new Dictionary<string, Type>();

        public Dictionary<string, Type> Popups
        {
            get { return m_popups; }
        }
    }
}
